﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using COFE.Core;
using COFE.Core.Profile;

namespace COFE.Core.Utils
{
    /// <summary>
    /// COFE version of System.IO.File static class, which provide static-like-methods to manipulate files.
    /// </summary>
    public interface IFileServices
    {
        /// <summary>
        /// Set by the parent manager.
        /// </summary>
        IUserProfile UserProfile { get; set; }

        /// <summary>
        /// Rename a file.
        /// </summary>
        /// <param name="srcFilePath">Source full file path.</param>
        /// <param name="destFilePath">Dest full file path.</param>
        void Move(string srcFilePath, string destFilePath);

        /// <summary>
        /// Copy a file.
        /// </summary>
        /// <param name="srcFilePath">Source full file path.</param>
        /// <param name="destFilePath">Destination full file path.</param>
        void Copy(string srcFilePath, string destFilePath);

        /// <summary>
        /// Return whether a file exists
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        bool Exists(string path);

        /// <summary>
        /// Delete a file.
        /// </summary>        
        void Delete(string path);
       
        /// <summary>
        /// Open a FileStream for the specified path.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="mode"></param>
        /// <param name="access"></param>
        /// <returns></returns>
        Stream Open(string path, FileMode mode, FileAccess access);

        /// <summary>
        /// Open a FileStream for the specified path.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        Stream Open(string path, FileMode mode);

        /// <summary>
        /// Open a FileStream for the specified path.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        Stream Open(string path);

        /// <summary>
        /// Open the specified path for reading.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        Stream OpenRead(string path);


        /// <summary>
        /// Open the specified path for writing.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        Stream OpenWrite(string path);
        
        /// <summary>
        /// Creates a StreamWriter that appends UTF-8 encoded text to an existing file.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        StreamWriter AppendText(string path);
        
        /// <summary>
        /// Opens an existing UTF-8 encoded text file for reading.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        StreamReader OpenText(string path);
        
        /// <summary>
        /// Creates or overwrites a file in the specified path.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        Stream Create(string path);        
    }

   
}
